# Contributor: Bradley J Chambers <brad.chambers@gmail.com>
# Maintainer: Bradley J Chambers <brad.chambers@gmail.com>
pkgname=flann
pkgver=1.9.2
pkgrel=0
pkgdesc="Fast Library for Approximate Nearest Neighbors"
url="https://github.com/flann-lib/flann"
arch="all"
license="BSD-3-Clause"
makedepends="cmake samurai lz4-dev hdf5-dev gtest-dev"
subpackages="$pkgname-doc $pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/flann-lib/flann/archive/$pkgver.tar.gz"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=None \
		-DBUILD_SHARED_LIBS=True
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	# Install license files
	install -Dm644 "$builddir"/COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING
}

sha512sums="
e1235383e4e3919607cd1417738220c1601342dcf908071a6f75039c45116bd558d9f0534be037b1a8ac5b4ba5b0be5b62bf1d96e44911f14b34f73d941addb2  flann-1.9.2.tar.gz
"
